<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDirectoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasTable('c_directory')) {
            Schema::create('cy_directory', function (Blueprint $table) {
                $table->increments('id')->comment('ID');
                $table->integer('course_id')->default(0)->comment('课程ID');
                $table->string('directory_title', 50)->comment('章节标题');
                $table->tinyInteger('isbuy')->default(0)->comment('是否收费(0:免费,1:收费)');
                $table->tinyInteger('cha_status')->default(0)->comment('是否使用(0:使用,1:关闭)');
                $table->string('chapter_img', 255)->default("")->nullable()->comment('封面');
                $table->string('chapter_video', 255)->default("")->nullable()->comment('视频');
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('c_directory');
    }
}
